package com.party.core.service.analysis.impl;

import com.party.common.paging.Page;
import com.party.core.dao.read.analysis.StatisticsFunnelFlowReadDao;
import com.party.core.dao.write.analysis.StatisticsFunnelFlowWriteDao;
import com.party.core.model.BaseModel;
import com.party.core.model.analysis.StatisticsFunnelFlow;
import com.party.core.service.analysis.IStatisticsFunnelFlowService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Set;

/**
 * @program: party-temp
 * @description: 统计漏斗接口实现
 * @author: Huaqunhao
 * @create: 2018-08-01 11:58
 **/
@Service
public class StatisticsFunnelFlowService implements IStatisticsFunnelFlowService {

    @Autowired
    private StatisticsFunnelFlowReadDao statisticsFunnelFlowReadDao;

    @Autowired
    private StatisticsFunnelFlowWriteDao statisticsFunnelFlowWriteDao;

    @Override
    public String insert(StatisticsFunnelFlow statisticsFunnel) {
        BaseModel.preInsert(statisticsFunnel);
        boolean result = statisticsFunnelFlowWriteDao.insert(statisticsFunnel);
        if (result) {
            return statisticsFunnel.getId();
        }
        return null;
    }

    @Override
    public boolean update(StatisticsFunnelFlow statisticsFunnel) {
        return statisticsFunnelFlowWriteDao.update(statisticsFunnel);
    }

    @Override
    public boolean deleteLogic(String id) {
        return false;
    }

    @Override
    public boolean delete(String id) {
        return statisticsFunnelFlowWriteDao.delete(id);
    }

    @Override
    public boolean batchDeleteLogic(Set<String> ids) {
        return false;
    }

    @Override
    public boolean batchDelete(Set<String> ids) {
        return false;
    }

    @Override
    public StatisticsFunnelFlow get(String id) {
        return statisticsFunnelFlowReadDao.get(id);
    }

    @Override
    public List<StatisticsFunnelFlow> listPage(StatisticsFunnelFlow statisticsFunnel, Page page) {
        return null;
    }

    @Override
    public List<StatisticsFunnelFlow> list(StatisticsFunnelFlow statisticsFunnel) {
        return null;
    }

    @Override
    public List<StatisticsFunnelFlow> batchList(Set<String> ids, StatisticsFunnelFlow statisticsFunnel, Page page) {
        return null;
    }

    @Override
    public List<StatisticsFunnelFlow> findByFunnelId(String funnelId) {
        StatisticsFunnelFlow funnelFlow = new StatisticsFunnelFlow();
        funnelFlow.setFunnelId(funnelId);
        return statisticsFunnelFlowReadDao.listPage(funnelFlow, null);
    }

    @Override
    public void deleteByFunnelId(String funnelId) {
        statisticsFunnelFlowWriteDao.deleteByFunnelId(funnelId);
    }

    @Override
    public StatisticsFunnelFlow getStepFlow(StatisticsFunnelFlow flow) {
        return statisticsFunnelFlowReadDao.getStepFlow(flow);
    }
}
